package com.ymh.spring.enums;

public enum StatusEnum {

	SUCCESS("SUC", "成功"), FAIL("FAIL", "失败");

	private String code;
	private String msg;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	private StatusEnum(String code, String msg) {
		this.code = code;
		this.msg = msg;
	}

	public static StatusEnum getStatusByCode(String code) {
		for (StatusEnum statusEnum : StatusEnum.values()) {
			if (statusEnum.getCode().equals(code)) {
				return statusEnum;
			}
		}
		return null;
	}

}
